package com.yb.sys.auth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yb.core.constant.DateTimeConstant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author 姚兵
 * @since 2022-11-17
 */

@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_sys_menu")
public class SysMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 菜单名称
     */
    @TableField(value = "`name`")
    private String name;

    /**
     * 前端菜单唯一标识
     */

    @TableField(value = "`key`")
    private String key;

    /**
     * 菜单路径
     */
    private String path;

    /**
     * 图标
     */
    private String icon;

    /**
     * 前端展示名称
     */
    private String label;

    /**
     * 前端收缩是展示的悬浮标题
     */
    private String title;

    /**
     * 0启用 1禁用
     */
    private Integer disabled;

    /**
     * 0-没有父节点，非0-有父节点，表示父节点id
     */
    private Integer parent;

    /**
     * 创建时间
     */

    @DateTimeFormat(pattern = DateTimeConstant.DATETIME_PATTERN)
    @JsonFormat(pattern =  DateTimeConstant.DATETIME_PATTERN)
    private LocalDateTime createTime;

    @DateTimeFormat(pattern = DateTimeConstant.DATETIME_PATTERN)
    @JsonFormat(pattern =  DateTimeConstant.DATETIME_PATTERN)
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private List<SysMenu> children;
}
